package com.h52mm.mybatis.demo.mapper;

import com.h52mm.mybatis.demo.model.Role;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RoleZjMapper {

    @Results({
            @Result(property = "id",column = "id"),
            @Result(property = "roleName",column = "roleName"),
            @Result(property = "users",column = "id",many = @Many(select = "com.h52mm.mybatis.demo.mapper.UserZjMapper.selectUsersByRid"))
    })
    @Select("select id,role_name roleName from t_role")
    public List<Role> selectRoleUsers();
}
